<template>
	<view v-if="list" class="content poRel">
		<view class="hei20"></view>
		<view class="wid90 mar borRad20 bacFFF " @click="tiaozhuan('/pages/wode/addressXuna')">
			<view style="height: 30rpx;"></view>
			<view class="wid90 mar dis disAl disJuB">
				<view class="dis disAl" style="width: 15%;">
					<!-- <image src="../../static/weizhi.png" style="width: 57rpx;height: 57rpx;"></image> -->
					<uni-icons custom-prefix="iconfont" size="60rpx" :color="theme.main_color"
						type="icon-dizhiguanli1"></uni-icons>
				</view>
				<view class="wid85 dis disAl disJuB">
					<view v-if="address" class="wid80">
						<view class="dis disAl foSi30 fowe600">
							<view>{{address.name}}</view>
							<view class="mar-left30">{{address.mobile}}</view>
						</view>
						<view class="dis disAl foSi25 mar-top20 webkitLineClamp" style="color: #737373;">
							{{address.address}}{{address.address_info}}
						</view>
					</view>
					<view v-if="!address" class="wid80 dis disAl foSi30 fowe600">请选择地址</view>
					<uni-icons type="right" size="45rpx"></uni-icons>
				</view>
			</view>
			<view style="height: 40rpx;"></view>
		</view>
		<view class="wid90 mar borRad20 bacFFF mar-top30">
			<view class="wid90 mar dis disAl disJuB hei80" style="border-bottom: 1px solid #E5E5E5;">
				<view class="foSi30 fowe600">服务时间</view>
				<view class="dis disAl" @click="open">
					<view class="foSi25 mar-right10" style="color: #737373;">{{datetimesingle}}</view>
					<uni-icons type="right" size="32rpx" color="#737373"></uni-icons>
				</view>
			</view>
			<view class="wid90 mar dis disAl disJuB" style="height: 89rpx;">
				<view class="foSi30 fowe600">出行方式</view>
				<view class="dis disAl">
					<view class="dis disAl disJuC borRad50" :style="'border: 1rpx solid '+theme.main_color+';'"
						style="width: 26rpx;height: 26rpx;">
						<view class="borRad50" :style="'background-color: '+theme.main_color+';'"
							style="width: 14rpx;height: 14rpx;"></view>
					</view>
					<view class="foSi25 mar-left10 fowe600" :style="'color: '+theme.main_color+';'">出租车</view>
				</view>
			</view>
		</view>
		<view class="wid90 mar bacFFF borRad20 mar-top30" style="padding: 30rpx 0;">
			<view class="wid90 mar dis disAl">
				<view style="height: 146rpx;width: 30%;">
					<image :lazy-load="true" :src="list.service.cover_img" style="width: 146rpx;"
						class="hei100 borRad10"></image>
				</view>
				<view style="width: 70%;">
					<view class="foSi30 fowe600 dis disAl">{{list.service.name}}</view>
					<view class=" mar-top20">
						<span class="foSi25 fowe600" style="color: #676565;vertical-align: bottom;">
							<span class="foSi30" style="color: #FF0000;">¥{{list.service.price}}</span>
							<span style="margin-left: 5rpx;">/ {{list.service.duration}}</span>
						</span>
					</view>
					<view class="dis disAl disJuB mar-top10 ">
						<view class="foSi25" style="color: #737373;">服务技师：{{name}}</view>
						<view class="dis disAl ">
							<image src="../../static/jian.png" @click="jian()" style="width: 30rpx;height: 30rpx;">
							</image>
							<view class="dis disAl disJuC" style="width: 64rpx;">{{quantity}}</view>
							<image src="../../static/jia.png" @click="jia()" style="width: 30rpx;height: 30rpx;">
							</image>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="wid90 mar bacFFF borRad20 mar-top30">
			<view class="wid90 mar dis disAl disJuB hei80">
				<view class="foSi30 fowe600">卡券优惠</view>
				<view v-if="couponList.length == 0" class="foSi25 dis disAl" style="color: #FF0101;">
					<view class="mar-right10">0张可用</view>
					<uni-icons type="right" size="35rpx"></uni-icons>
				</view>
				<picker v-else @change="bindCouponChange" :value="couponIndex" :range="couponList"
					:range-key="'use_text'">
					<view class="foSi25 dis disAl" style="color: #FF0101;">
						<view class="mar-right10">{{couponIndex!=null?couponList[couponIndex].use_text:'请选择卡券'}}</view>
						<uni-icons type="right" size="35rpx"></uni-icons>
					</view>
				</picker>
			</view>
			<view v-if="address" class="hei86 wid90 mar dis disAl disJuB" style="border-top: 1rpx solid #E5E5E5;">
				<view class="foSi30 fowe600">往返车费</view>
				<view class="foSi25 fowe600" style="color: #FF0000;">¥{{list.carinfo.distance_price.toFixed(2)}}</view>
			</view>
			<view v-if="address" class="wid90 mar foSi20" style="color: #737373;">
				<view>{{list.carinfo.distance_text}}</view>
				<view class="mar-top10">{{list.carinfo.distance_text2}}</view>
			</view>
			<view v-if="address" style="height: 30rpx;"></view>
		</view>
		<view class="wid90 mar bacFFF borRad20 mar-top30">
			<view class="wid90 mar dis disAl foSi30 fowe600 hei86">备注<span style="color: #AEADAD;">（选填）</span></view>
			<textarea class="wid90 mar foSi30" style="line-height: 45rpx;" v-model="beizhu" placeholder="输入订单备注"
				auto-height />
			<view style="height: 40rpx;"></view>
		</view>
		<view class="mar-top30 wid90 mar bacFFF borRad20">
			<!-- <view class="wid90 mar hei86 dis disAl disJuB" @click="xuanzeClick(2)"
				style="border-bottom: 1rpx solid #E5E5E5;">
				<view class="dis disAl">
					<image src="../../static/yuebao.png" style="width: 35rpx;height: 39rpx;"></image>
					<view class="foSi30 fowe600 mar-left20">账户余额</view>
					<view class="foSi22 mar-left20" style="color: #737373;">余额{{userinfo.money || 0.00}}元</view>
				</view>
				<view v-if="xuanze == 2" class="dis disAl disJuC borRad50"
					:style="'border: 1rpx solid '+theme.main_color+';'" style="width: 26rpx;height: 26rpx;">
					<view class="borRad50" :style="'background-color: '+theme.main_color+';'"
						style="width: 14rpx;height: 14rpx;"></view>
				</view>
				<view v-if="xuanze != 2" class="dis disAl disJuC borRad50"
					style="width: 26rpx;height: 26rpx;border: 1rpx solid #818181;"></view>
			</view> -->
			<view class="wid90 mar hei86 dis disAl disJuB" @click="xuanzeClick(1)">
				<view class="dis disAl">
					<image src="../../static/weixinzhifu.png" style="width: 38rpx;height: 31rpx;"></image>
					<view class="foSi30 fowe600 mar-left20">微信支付</view>
				</view>
				<view v-if="xuanze == 1" class="dis disAl disJuC borRad50"
					:style="'border: 1rpx solid '+theme.main_color+';'" style="width: 26rpx;height: 26rpx;">
					<view class="borRad50" :style="'background-color: '+theme.main_color+';'"
						style="width: 14rpx;height: 14rpx;"></view>
				</view>
				<view v-if="xuanze != 1" class="dis disAl disJuC borRad50"
					style="width: 26rpx;height: 26rpx;border: 1rpx solid #818181;"></view>
			</view>
			<!-- #ifdef APP -->
			<!-- <view class="wid90 mar hei86 dis disAl disJuB" @click="xuanzeClick(3)">
				<view class="dis disAl">
					<image src="../../static/zhifubao.png" style="width: 38rpx;height: 31rpx;"></image>
					<view class="foSi30 fowe600 mar-left20">支付宝支付</view>
				</view>
				<view v-if="xuanze == 3" class="dis disAl disJuC borRad50"
					:style="'border: 1rpx solid '+theme.main_color+';'" style="width: 26rpx;height: 26rpx;">
					<view class="borRad50" :style="'background-color: '+theme.main_color+';'"
						style="width: 14rpx;height: 14rpx;"></view>
				</view>
				<view v-if="xuanze != 3" class="dis disAl disJuC borRad50"
					style="width: 26rpx;height: 26rpx;border: 1rpx solid #818181;"></view>
			</view> -->
			<!-- #endif -->
		</view>
		<view style="height: 150rpx;"></view>
		<view class="poFix wid100 bacFFF" style="height: 124rpx;bottom: 0;">
			<view class="wid90 hei100 mar dis disAl disJuB">
				<view class="dis disAl foSi35 fowe600">
					<span>合计：</span>
					<span
						style="color: #FF0000;">¥{{(list.service.price * quantity + (address?Number(list.carinfo.distance_price):0) - money).toFixed(2)}}</span>
				</view>
				<view class="dis disAl disJuC foSi35 coFFF fowe600 hei80 borRad40"
					:style="'background-color: '+theme.main_color+';'" style="width: 232rpx;" @click="zhufu">立即支付</view>
			</view>
		</view>
		<uni-popup ref="popup" background-color="#fff" type="bottom" border-radius="10px 10px 0 0">
			<view class="wid95 mar">
				<scroll-view class="scroll-view_H wid100" scroll-x="true">
					<block v-for="(item, index) in dateList" :key="index">
						<view class="wid25" @click="dateClick(index)" style="height: 84rpx;display: inline-block;">
							<view class="hei80 dis disAl disJuC foSi30"
								:style="dateXuan == index?'color: '+theme.main_color+';':''">
								{{item.day_text}} {{item.week}}
							</view>
							<view class="mar" style="width: 80rpx;height: 4rpx;"
								:style="dateXuan == index?'background-color: '+theme.main_color+';':'background-color: #fff;'">
							</view>
						</view>
					</block>
				</scroll-view>
				<view class="dis disAl flwa mar-top30">
					<block v-for="(item, index) in timeList" :key="index">
						<view class="foSi25 mar-bott30" style="width: 23.5%;"
							:style="(index+1) % 4 !== 0?'margin-right: 2%;':''">
							<view v-if="item.is_order != 1 && item.status != 1" class="textCen borRad20"
								style="padding: 20rpx 0;" @click="timeClick(index)"
								:style="timeXuan == index?'background-color: '+theme.main_color+';color: #fff;':'border: 1rpx solid #E5E5E5;'">
								<view class="foSi28">{{item.time_text}}</view>
								<view class="mar-top10">可预约</view>
							</view>
							<view v-if="item.is_order == 1 || item.status == 1" class="textCen borRad20"
								style="padding: 20rpx 0;background-color: #E5E5E5;color: #CACACA;">
								<view class="foSi28">{{item.time_text}}</view>
								<view class="mar-top10">不可预约</view>
							</view>
						</view>
					</block>
				</view>
				<view class="hei20"></view>
			</view>
		</uni-popup>

		<uni-popup ref="popup_mobile" type="center">
			<view class="borRad20 bacFFF" style="width: 596rpx;padding: 30rpx 0;">
				<view class="wid90 mar">
					<view class="borRad20 dis disAl disJuC" style="height: 90rpx;background-color: #EEEEEE;">
						<input class="wid90 foSi30" v-model="mobile" type="number" placeholder="请输入手机号" />
					</view>
					<view class="borRad20 dis disAl disJuC mar-top30" style="height: 90rpx;background-color: #EEEEEE;">
						<input style="width: 65%;" class="foSi30" v-model="code" placeholder="请输入验证码" />
						<view v-if="sec == 0" @click="getCheckNum()" class="dis disAl disJuC wid25 foSi25"
							style="color: #9D9D9D;">获取验证码</view>
						<view v-if="sec > 0" class="dis disAl disJuC wid25" style="color: #9D9D9D;">{{sec}}s</view>
					</view>
					<view class="mar-top40 hei80 borRad40 dis disAl disJuC coFFF mar foSi30" @click="baocunMobile()"
						style="background-color: #00C82D;width: 50%;">保存</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	// #ifdef H5
	var jweixin = require('jweixin-module');
	// #endif
	export default {
		data() {
			return {
				url: this.global.url,
				id: '',
				jishi_id: '',
				startDate: '',
				datetimesingle: '请选择预约时间',
				quantity: 1,
				couponIndex: null,
				couponList: [],
				beizhu: '',
				xuanze: 1,
				dateList: [],
				dateXuan: 0,
				timeXuan: null,
				timeList: [],
				address: null,
				list: null,
				userinfo: null,
				name: '',
				money: 0,
				time_str: 0,

				mobile: '',
				code: '',
				sec: 0, //这是重新获取验证码的倒计时
				imin: 1,
				theme: null
			}
		},
		onLoad(option) {
			this.id = option.id
			this.jishi_id = option.jishi_id
			this.name = option.name
			this.theme = uni.getStorageSync('theme')
			this.getDate()
			this.getList()
			this.getUser()
		},
		onShow() {
			let that = this
			uni.$on('addressClick', function(data) {
				that.address = data
				console.log('监听到事件来自 updateData ，携带参数为：');
				console.log(data);
				that.getList()
			})
		},
		methods: {
			getCheckNum() {
				var that = this;
				// 初始化定时器
				let t = null;
				// 倒计时1分钟
				this.sec = 60
				that.getCode()
				// 计时器清零
				clearInterval(t);
				// that.sendcode()
				t = setInterval(() => {
					// 当倒计时完时，显示重新发送
					if (this.sec == 0) {
						clearInterval(t);
						return;
					}
					// 实现倒计时效果
					this.sec--;
				}, 1000)

			},
			getCode() {
				var that = this;
				uni.request({
					url: that.global.url + 'api/qianyu_smfw/common/send_code',
					method: "POST",
					header: {
						'site-id': that.global.site_id //自定义请求头信息
					},
					data: {
						mobile: that.mobile
					},
					success(res) {
						let result = res.data
						if (result.code == 1) {
							uni.showToast({
								title: result.msg,
								//显示持续时间为 2秒
								duration: 2000
							})
						} else {
							uni.showToast({
								title: result.msg,
								//将值设置为 success 或者直接不用写icon这个参数
								icon: 'error',
								//显示持续时间为 2秒
								duration: 2000
							})
						}
					}
				})
			},
			baocunMobile() {
				var that = this;
				//正则表达式定义手机号正确格式
				let reg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
				if (!reg.test(that.mobile)) {
					return uni.showToast({
						title: '请输入正确手机号',
						icon: 'error',
						duration: 2000
					})
				};
				if (!that.code) {
					return uni.showToast({
						title: '请输入验证码',
						icon: 'error',
						duration: 2000
					})
				};
				uni.request({
					url: that.global.url + 'api/qianyu_smfw/user/upmobile',
					method: "POST",
					header: {
						'site-id': that.global.site_id, //自定义请求头信息
						'token': uni.getStorageSync('token')
					},
					data: {
						mobile: that.mobile,
						code: that.code
					},
					success(res) {
						let result = res.data
						if (result.code == 1) {
							that.phone = that.mobile
							that.$refs.popup_mobile.close()
						} else {
							if (result.msg == '手机号码重复') {
								// 询问是否同步账号
								uni.showModal({
									title: '提示',
									content: '该手机号码已注册，是否同步当前账号？',
									success: function(res) {
										if (res.confirm) {
											// 执行确认后的操作
											uni.request({
												url: that.global.url + 'api/qianyu_smfw/user/account_synchronization',
												method: "POST",
												header: {
													'site-id': that.global.site_id, //自定义请求头信息
													'token': uni.getStorageSync('token')
												},
												data: {
													mobile: that.mobile
												},
												success(res) {
													let result = res.data
													console.log(result)
													if (result.code == 1) {
														uni.setStorageSync('token',result.data)
														uni.showToast({
															title: '同步成功',
															//将值设置为 success 或者直接不用写icon这个参数
															icon: 'error',
															//显示持续时间为 2秒
															duration: 2000
														})
														that.phone = that.mobile
														that.$refs.popup_mobile.close()
													} else {
														uni.showToast({
															title: result.msg,
															//将值设置为 success 或者直接不用写icon这个参数
															icon: 'error',
															//显示持续时间为 2秒
															duration: 2000
														})
													}
												}
											})
										} else {
											// 执行取消后的操作
											uni.showToast({
												title: result.msg,
												//将值设置为 success 或者直接不用写icon这个参数
												icon: 'error',
												//显示持续时间为 2秒
												duration: 2000
											}) 
										}
									}
								})
							}else{
								uni.showToast({
									title: result.msg,
									//将值设置为 success 或者直接不用写icon这个参数
									icon: 'error',
									//显示持续时间为 2秒
									duration: 2000
								}) 
							}
						}
					}
				})
			},
			zhufu() {
				var that = this
				if (!that.address) {
					return uni.showToast({
						title: '请选择地址',
						icon: 'error',
						duration: 2000
					})
				};
				if (!that.timeXuan && that.timeXuan != 0) {
					return uni.showToast({
						title: '请选择预约时间',
						icon: 'error',
						duration: 2000
					})
				};

				if (that.xuanze == 1) {
					// #ifdef APP
					that.xuanze = 4 // 重置为APP微信支付
					// #endif
				}
				uni.request({
					url: that.global.url + 'api/qianyu_smfw/order/creat_order',
					method: 'POST',
					header: {
						'site-id': that.global.site_id,
						'token': uni.getStorageSync('token')
					},
					data: {
						'tech_id': that.jishi_id,
						'service_id': that.id,
						'address_id': that.address.id,
						'coupon_id': that.couponIndex ? that.couponList[that.couponIndex].couponid : 0,
						'service_num': that.quantity,
						'pay_type': that.xuanze,
						'start_time': that.time_str,
						'distance_price': that.list.carinfo.distance_price.toFixed(2),
						'distance': that.list.carinfo.distance.toFixed(2)
					},
					success(res) {
						let result = res.data
						console.log(result);
						if (that.xuanze == 1 || that.xuanze == 4) {
							if (result.code == 1) {
								console.log(result);
								// #ifdef H5
								jweixin.config({
									debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
									appId: result.data.appId, // 必填，公众号的唯一标识
									timestamp: result.data.timeStamp, // 必填，生成签名的时间戳
									nonceStr: result.data.nonceStr, // 必填，生成签名的随机串
									signature: result.data.paySign, // 必填，签名
									jsApiList: ['chooseWXPay'] // 必填，需要使用的JS接口列表
								})
								jweixin.ready(function() {
									jweixin.chooseWXPay({
										appId: result.data.appId,
										package: result.data.package, //
										timestamp: result.data.timeStamp, // 时间戳
										nonceStr: result.data.nonceStr, // 随机数
										signType: result.data.signType,
										paySign: result.data.paySign, // 签名
										success: function() {
											// 支付成功
											uni.showModal({
												title: '提示',
												content: '支付成功',
												showCancel: false,
												success: function(res) {
													if (res.confirm) {
														uni.redirectTo({
															url: '/pages/indent/indent?xuan=0',
														});
													}
												}
											})
										},
										cancel: function() {
											// 支付失败
											console.log(res)
											uni.showToast({
												title: '取消支付',
												icon: 'none',
												duration: 2000
											})
										},
										fail: function() {
											// 支付失败
											console.log(res)
											uni.showToast({
												title: '支付失败',
												icon: 'none',
												duration: 2000
											})
										}
									})
								})
								// #endif
								// #ifdef APP
								//调用微信官方支付接口弹出付款界面,输入密码扣款
								let back_info = result.data
								console.log('back_info',back_info)
								uni.requestPayment({
									provider: 'wxpay',
									orderInfo: { 
										"appid": back_info.appid,  // 微信开放平台 - 应用 - AppId，注意和微信小程序、公众号 AppId 可能不一致
										"package": back_info.package,        // 固定值
										"noncestr": back_info.noncestr, // 随机字符串
										"timestamp": back_info.timestamp,        // 时间戳（单位：秒）
										"sign": back_info.paySign, // 签名，这里用的 MD5/RSA 签名
										"prepayid": back_info.prepayid, // 统一下单订单号
										"partnerid": back_info.partnerid,      // 微信支付商户号
									}, //微信、支付宝订单数据 【注意微信的订单信息，键值应该全部是小写，不能采用驼峰命名】
									success: function(res) {
										// 支付成功
										uni.showModal({
											title: '提示',
											content: '支付成功',
											showCancel: false,
											success: function(res) {
												if (res.confirm) {
													uni.redirectTo({
														url: '/pages/indent/indent?xuan=0',
													});
												}
											}
										})
									},
									fail: function(err) {
										// 支付失败
										console.log(res)
										uni.showToast({
											title: '支付失败',
											icon: 'none',
											duration: 2000
										})
									}
								});

								// #endif

							} else {
								if (result.code == '-2') {
									uni.showToast({
										title: result.msg,
										icon: 'none',
										duration: 2000
									})
									that.popup_mobile_open();
								} else {
									uni.showToast({
										title: result.msg,
										icon: 'none',
										duration: 2000
									})
								}
							}
						} else {
							if (result.code == 1) {
								// 支付成功
								uni.showModal({
									title: '提示',
									content: '支付成功',
									showCancel: false,
									success: function(res) {
										if (res.confirm) {
											uni.reLaunch({
												url: '/pages/indent/indent?xuan=0',
											});
										}
									}
								})
							} else {
								that.userinfo = ''
								if (result.code == '-2') {
									uni.showToast({
										title: result.msg,
										icon: 'none',
										duration: 2000
									})
									that.popup_mobile_open();
								} else {
									uni.showToast({
										title: result.msg,
										icon: 'none',
										duration: 2000
									})
								}
							}
						}
					}
				})
			},
			popup_mobile_open() {
				console.log(121111111111);
				this.$refs.popup_mobile.open()
			},
			bindCouponChange: function(e) {
				this.couponIndex = e.detail.value
				this.money = this.couponList[this.couponIndex].coupon.dis_money
			},
			getUser() {
				var that = this
				uni.request({
					url: that.global.url + 'api/qianyu_smfw/user/userinfo',
					method: 'POST',
					header: {
						'site-id': that.global.site_id,
						'token': uni.getStorageSync('token')
					},
					data: {},
					success(res) {
						let result = res.data
						if (result.code == 1) {
							that.userinfo = result.data
						} else {
							that.userinfo = ''
							uni.showToast({
								title: result.msg,
								icon: 'none',
								duration: 2000
							})
						}
					}
				})
			},
			dateClick(index) {
				if (this.dateXuan != index) {
					this.dateXuan = index
					this.timeXuan = null
					this.getTime()
				}
			},
			timeClick(index) {
				if (this.timeXuan != index) {
					this.timeXuan = index
					this.datetimesingle =
						this.dateList[this.dateXuan].day_text + " " + this.dateList[this.dateXuan].week + " " + this
						.timeList[this.timeXuan].time_text
					this.time_str = this.timeList[this.timeXuan].time_str
					this.$refs.popup.close()
				}
			},
			open() {
				// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ，type 属性将失效 ，仅支持 ['top','left','bottom','right','center']
				this.$refs.popup.open()
			},
			getCoupon() {
				var that = this
				uni.request({
					url: that.global.url + 'api/qianyu_smfw/plugin/coupon_lists_order',
					method: 'POST',
					header: {
						'site-id': that.global.site_id,
						'token': uni.getStorageSync('token')
					},
					data: {
						'service': that.id,
						'num': that.quantity
					},
					success(res) {
						let result = res.data
						if (result.code == 1) {
							that.couponList = result.data
						} else {
							that.userinfo = ''
							uni.showToast({
								title: result.msg,
								icon: 'none',
								duration: 2000
							})
						}
					}
				})
			},
			getList() {
				var that = this
				uni.request({
					url: that.global.url + 'api/qianyu_smfw/order/order_content',
					method: 'POST',
					header: {
						'site-id': that.global.site_id,
						'token': uni.getStorageSync('token')
					},
					data: {
						'tech_id': that.jishi_id,
						'service_id': that.id,
						'city': uni.getStorageSync('city').id,
						'lon': that.address ? that.address.lon : '',
						'lat': that.address ? that.address.lat : '',
						'service_num': 1
					},
					success(res) {
						let result = res.data
						if (result.code == 1) {
							that.list = result.data
							that.getCoupon()
						} else {
							that.userinfo = ''
							uni.showToast({
								title: result.msg,
								icon: 'none',
								duration: 2000
							})
						}
					}
				})
			},
			getDate() {
				var that = this
				uni.request({
					url: that.global.url + 'api/qianyu_smfw/technician/reservation',
					method: 'POST',
					header: {
						'site-id': that.global.site_id,
						'token': uni.getStorageSync('token')
					},
					data: {
						// 'tech_id': that.id
						'tech_id': that.jishi_id
					},
					success(res) {
						let result = res.data
						if (result.code == 1) {
							that.dateList = result.data
							that.getTime()
						} else {
							that.userinfo = ''
							uni.showToast({
								title: result.msg,
								icon: 'none',
								duration: 2000
							})
						}
					}
				})
			},
			getTime() {
				var that = this
				uni.request({
					url: that.global.url + 'api/qianyu_smfw/technician/reservation_time',
					method: 'POST',
					header: {
						'site-id': that.global.site_id,
						'token': uni.getStorageSync('token')
					},
					data: {
						// 'tech_id': that.id
						'tech_id': that.jishi_id,
						'day_time': that.dateList[that.dateXuan].day_time
					},
					success(res) {
						let result = res.data
						if (result.code == 1) {
							that.timeList = result.data
						} else {
							that.userinfo = ''
							uni.showToast({
								title: result.msg,
								icon: 'none',
								duration: 2000
							})
						}
					}
				})
			},
			xuanzeClick(index) {
				this.xuanze = index
			},
			jia() {
				this.quantity = this.quantity + 1
				this.getCoupon()
			},
			jian() {
				if (this.quantity > 1) {
					this.quantity = this.quantity - 1
					this.getCoupon()
				}
			},
			tiaozhuan(url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style>
	.content {
		min-height: 100vh;
		background-color: #F3F1F1;
	}

	.scroll-view_H {
		white-space: nowrap;
	}
</style>